package com.example.version.controll.util;

import org.eclipse.jgit.api.errors.GitAPIException;
import org.springframework.util.StopWatch;

import java.util.function.Supplier;
import java.util.logging.Logger;

public class StopWatchUtil {

    private static Logger LOGGER = Logger.getLogger(StopWatchUtil.class.getName());

    public static  <T> T stopWatch(Supplier<T> func){
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        T t = func.get();
        stopWatch.stop();
        LOGGER.info("耗时:" + stopWatch.getTotalTimeMillis());
        return t;
    }
}
